<?php
/**
 * This file will stored all config for each field type
 * Almost functions return string config for each field
 * @author	muinx
 */

class FieldTypeConfigHelper
{
	protected $fieldName;
	protected $fieldValue;
	
	/**
	 * Init some var for class
	 * @param String $name		Field Name
	 * @param String $value		Field Value
	 */
	function __construct($name, $value)
	{
		$value = str_replace("'", "\'", $value);
		$this->fieldName = $name;
		$this->fieldValue = unserialize($value);
	}
	
	/**
	 * Build table
	 * @param String $content	Content
	 * @return String
	 */
	function buildTable($content)
	{
		$table  = '<table>';
		$table .= '<tr>';
		$table .= '<td colspan="20"><b>Configuration</b><td>';
		$table .= '</tr>';
		$table .= $content;		
		$table .= '<table>';
		
		return $table;		
	}
	
	/**
	 * Category field
	 */
	public function getCategory()
	{
		$value = $this->fieldValue;
		
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Extension</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][extension]" value="'. (isset($value['extension']) ? $value['extension'] : null) .'" /></td>';
		$content .= '<td>Published</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][published]" value="'. (isset($value['published']) ? $value['published'] : null) .'" /></td>';
		$content .= '<td>Show root?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][show_root]" value="1" '. (isset($value['show_root']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Check permission?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][action]" value="action" '. ( (isset($value['action']) && $value['action'] == 'action') ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		
		$html = self::buildTable($content);
			
		return $html;
	}
	
	/**
	 * Custom field
	 */
	public function getCustom()
	{
		$value = $this->fieldValue;
		
		$content  = '<tr>';
		$content .= '<td>Table</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][table]" size="30" value="'. (isset($value['table']) ? $value['table'] : null) .'" /></td>';
		$content .= '<td>Field</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][field]" size="30" value="'. (isset($value['field']) ? $value['field'] : null) .'" /></td>';
		$content .= '<td>(Format: value, text. Example: id, name)</td>';
		$content .= '</tr>';
		
		$html = self::buildTable($content);
			
		return $html;
	}
	
	/**
	 * Editor field
	 */
	public function getEditor()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Rows</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][rows]" size="10" value="'. (isset($value['rows']) ? $value['rows'] : null) .'" /></td>';
		$content .= '<td>Cols</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][cols]" size="10" value="'. (isset($value['cols']) ? $value['cols'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Height</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][rows]" size="10" value="'. (isset($value['rows']) ? $value['rows'] : null) .'" /></td>';
		$content .= '<td>Width</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][cols]" size="10" value="'. (isset($value['cols']) ? $value['cols'] : null) .'" /> (%)</td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Show Button</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][buttons]" value="1"'. (isset($value['buttons']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Hide Button</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][hide]" size="30" value="'. (isset($value['hide']) ? $value['hide'] : null) .'" /></td>';		
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Email field
	 */
	public function getEmail()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Read Only</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][readonly]" value="1"'. (isset($value['readonly']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : '1') .'" /></td>';
		$content .= '<td>Max Length</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][maxlength]" size="5" value="'. (isset($value['maxlength']) ? $value['maxlength'] : '30') .'" /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}

	/**
	 * File
	 */
	public function getFile()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Onchange</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][on_change]" size="50" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Accept</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][accept]" size="50" value="'. (isset($value['accept']) ? $value['accept'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Hidden
	 * @return string
	 */
	public function getHidden()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Integer
	 * @return string
	 */
	public function getInteger()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>First</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][first]" size="10" value="'. (isset($value['first']) ? $value['first'] : '0') .'" /></td>';
		$content .= '<td>Last</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][last]" size="10" value="'. (isset($value['last']) ? $value['last'] : null) .'" /></td>';
		$content .= '<td>Step</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][step]" size="10" value="'. (isset($value['step']) ? $value['step'] : '1') .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Language
	 * @return string
	 */
	public function getLanguage()
	{
		$value = $this->fieldValue;
		
		$selectSite = (isset($value['client']) && $value['client'] == 'site') ? 'selected="selected"' : null;
		$selectAdmin = (isset($value['client']) && $value['client'] == 'administrator') ? 'selected="selected"' : null;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Client</td>';
		$content .= '<td>
						<select name="field['.$this->fieldName.'][client]">
							<option value="administrator" '.$selectAdmin.'>Administrator</option>
							<option value="site" '.$selectSite.'>Site</option>
					</td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * List
	 * @return string
	 */
	public function getList()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Read Only</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][readonly]" value="1"'. (isset($value['readonly']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Multiple</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][multiple]" value="1" '. (isset($value['multiple']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td valign="top">Options</td>';
		$content .= '<td colspan="8"><textarea rows="5" style="width:100%" name="field['.$this->fieldName.'][options_value]">'. (isset($value['options_value']) ? str_replace("\'", "'", $value['options_value']) : null) .'</textarea></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td></td><td colspan="7">Option format: value, text. Seperate by new line. If want to add attributes to option, add | after option. <br>
		Attributes include: disabled, class, onclick.
		Example:<br> 1, Option 1 | onclick:testClick()<br>2, Option 2 | class:test-class, disabled<br>3, Option 3<br>
		Option 1 will have attribute: onclick="testClick()". Option 2 will have atributes: class="test-class" and disabled.</td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Media
	 * @return string
	 */
	public function getMedia()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : null) .'" /></td>';
		$content .= '<td>Folder</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][folder]" size="10" value="'. (isset($value['folder']) ? $value['folder'] : null) .'" /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Password
	 * @return string
	 */
	public function getPassword()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : '1') .'" /></td>';
		$content .= '<td>Max Length</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][maxlength]" size="10" value="'. (isset($value['maxlength']) ? $value['maxlength'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Auto complete</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][autocomplete]" value="off"'. (isset($value['autocomplete']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Read Only</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][readonly]" value="1"'. (isset($value['readonly']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Onchange</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Radion
	 * @return string
	 */
	public function getRadio()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td valign="top">Options</td>';
		$content .= '<td colspan="8"><textarea rows="5" style="width:100%" name="field['.$this->fieldName.'][options_value]">'. (isset($value['options_value']) ? str_replace("\'", "'", $value['options_value']) : null) .'</textarea></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td></td><td colspan="7">Option format: value, text. Seperate by new line. If want to add attributes to option, add | after option. <br>
		Attributes include: disabled, class, onclick.
		Example:<br> 1, Option 1 | onclick:testClick()<br>2, Option 2 | class:test-class, disabled<br>3, Option 3<br>
		Option 1 will have attribute: onclick="testClick()". Option 2 will have atributes: class="test-class" and disabled.</td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Checkbox
	 * @return string
	 */
	public function getCheckbox()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Value</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][value]" value="'. (isset($value['value']) ? $value['value'] : '1') .'" /></td>';
		$content .= '<td>Onclick</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][onclick]" size="30" value="'. (isset($value['onclick']) ? $value['onclick'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}

	/**
	 * Combo
	 * @return string
	 */
	public function getCombo()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Value</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][value]" value="'. (isset($value['value']) ? $value['value'] : '1') .'" /></td>';
		$content .= '<td>Onclick</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][onclick]" size="30" value="'. (isset($value['onclick']) ? $value['onclick'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td valign="top">Options</td>';
		$content .= '<td colspan="8"><textarea rows="5" style="width:100%" name="field['.$this->fieldName.'][options_value]">'. (isset($value['options_value']) ? str_replace("\'", "'", $value['options_value']) : null) .'</textarea></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td></td><td colspan="7">Option format: value, text. Seperate by new line. If want to add attributes to option, add | after option. <br>
						Attributes include: disabled, class, onclick.
						Example:<br> 1, Option 1 | onclick:testClick()<br>2, Option 2 | class:test-class, disabled<br>3, Option 3<br>
						Option 1 will have attribute: onclick="testClick()". Option 2 will have atributes: class="test-class" and disabled.</td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Checkboxes
	 * @return string
	 */
	public function getCheckboxes()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td width="50">Class</td>';
		$content .= '<td width="50"><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td width="30">Disabled</td>';
		$content .= '<td width="100"><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>&nbsp;</td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td valign="top">Options</td>';
		$content .= '<td colspan="6"><textarea rows="5" name="field['.$this->fieldName.'][options_value]">'. (isset($value['options_value']) ? str_replace("\'", "'", $value['options_value']) : null) .'</textarea></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td></td><td colspan="5">Option format: value, text. Seperate by new line. If want to add attributes to option, add | after option. <br>
		Attributes include: disabled, class, onclick.
		Example:<br> 1, Option 1 | onclick:testClick()<br>2, Option 2 | class:test-class, disabled<br>3, Option 3<br>
		Option 1 will have attribute: onclick="testClick()". Option 2 will have atributes: class="test-class" and disabled.</td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Access Level
	 * @return string
	 */
	public function getAccessLevel()
	{
		$value = $this->fieldValue;
		
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : '1') .'" /></td>';
		$content .= '<td>Multiple</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][multiple]" value="1" '. (isset($value['multiple']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
		
		$html = self::buildTable($content);
			
		return $html;
	}
	
	/**
	 * Calendar
	 * @return string
	 */
	public function getCalendar()
	{
		$value = $this->fieldValue;
		
		$content  = '<tr>';	
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Format</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][calendar_format]" size="30" value="'. (isset($value['calendar_format']) ? $value['calendar_format'] : '%Y-%m-%d %H:%M:%S') .'" /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : '22') .'" /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Read Only</td>';		
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][readonly]" value="1" '. (isset($value['readonly']) ? 'checked="checked"' : null) .' /></td>';	
		$content .= '<td>Filter</td>';
		
		$serverUtcSelected = $userUtcSelected = null;
		
		if(isset($value['filter']))
		{
			if($value['filter'] == 'server_utc')
				$serverUtcSelected = 'selected="selected"';
			else 
				$userUtcSelected = 'selected="selected"';
		}
		
		$content .= '<td colspan="3">
					<select name="field['.$this->fieldName.'][filter]">
						<option value="server_utc" '.$serverUtcSelected.'>SERVER_UTC</option>
						<option value="user_utc" '.$userUtcSelected.'>USER_UTC</option>
					</select>
				</td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Onchange</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
		
		$html = self::buildTable($content);

		return $html;
	}
	
	/**
	 * Text
	 * @return string
	 */
	public function getText()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : null) .'" /></td>';
		$content .= '<td>Max Length</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][maxlength]" size="10" value="'. (isset($value['maxlength']) ? $value['maxlength'] : null) .'" /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Read Only</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][readonly]" value="1"'. (isset($value['readonly']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Onchange</td>';
		$content .= '<td colspan="8"><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * Textarea
	 * @return string
	 */
	public function getTextarea()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Required?</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][required]" value="1" '. ( (isset($value['required']) && $value['required'] == '1') ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
		$content .= '<tr>';
		$content .= '<td>Cols</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][cols]" size="10" value="'. (isset($value['cols']) ? $value['cols'] : null) .'" /></td>';
		$content .= '<td>Rows</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][rows]" size="10" value="'. (isset($value['rows']) ? $value['rows'] : null) .'" /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * User
	 * @return string
	 */
	public function getUser()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Size</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][size]" size="10" value="'. (isset($value['size']) ? $value['size'] : '1') .'" /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
	
	/**
	 * User Group
	 * @return string
	 */
	public function getUserGroup()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>Disabled</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][disabled]" value="1"'. (isset($value['disabled']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Multiple</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][multiple]" value="1" '. (isset($value['multiple']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '<td>Onchange</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][on_change]" size="30" value="'. (isset($value['on_change']) ? $value['on_change'] : null) .'" /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}

	/**
	 * Spacer
	 * @return string
	 */
	public function getSpacer()
	{
		$value = $this->fieldValue;
	
		$content  = '<tr>';
		$content .= '<td>Class</td>';
		$content .= '<td><input type="text" name="field['.$this->fieldName.'][class]" size="10" value="'. (isset($value['class']) ? $value['class'] : null) .'" /></td>';
		$content .= '<td>hr tag</td>';
		$content .= '<td><input type="checkbox" name="field['.$this->fieldName.'][hr]" value="1"'. (isset($value['hr']) ? 'checked="checked"' : null) .' /></td>';
		$content .= '</tr>';
	
		$html = self::buildTable($content);
	
		return $html;
	}
}